<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

class CreateSourceMaterialTemplateTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('source_material_template', function (Blueprint $table) {
            $table->id();
            $table->string("name", 50)->default('')->comment("模版名称");
            $table->string("url", 255)->default('')->comment("预览图");
            $table->string("reverseUrl", 255)->default('')->comment("背面预览图");
            $table->string("thumbnail", 255)->default('')->comment("缩略图");
            $table->string("reverseThumbnail", 255)->default('')->comment("背面缩略图");
            $table->json('value')->nullable()->comment('模版配置信息');
            $table->json('appValue')->nullable()->comment('app模版配置信息');
            $table->tinyInteger("type")->default(0)->comment("素材类型 1：开业活动免费吃 2 ：开业活动进店送 3 ：招聘海报 4 ：好评卡外卖海报");
            $table->string("size", 50)->default('')->comment("模版图片尺寸（cm）");
            $table->unsignedInteger("sort")->default(255)->comment("排序 越小越靠前");
            $table->tinyInteger('isDeleted')->default(0)->comment("是否删除 0：未删除，1：已删除");

            $table->unsignedInteger('createdAt')->default(0)->comment('创建时间');
            $table->unsignedInteger('updatedAt')->default(0)->comment('更新时间');
            $table->unsignedInteger('createdByUid')->default(0)->comment('创建人');
            $table->unsignedInteger('updatedByUid')->default(0)->comment('更新人');
            $table->collation = 'utf8mb4_general_ci';
            $table->comment = '物料素材模版表';
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('source_material_template');
    }
}
